package com.aba.cms5zu.Main;
import java.util.Map;
import com.aba.cms5zu.abmin.Abmin;
import com.aba.cms5zu.houseparent.Houseparent;
import com.aba.cms5zu.parent.Parent;
import com.aba.cms5zu.student.Student;
import java.util.Collections;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) {
         // 初始化模块
        Abmin abmin = new Abmin();
       Houseparent parent = new Houseparent();
        /* Student student = new Student(); */
        Student student = new Student("2025001", "李四", "D305");

        // ------------------ 管理员操作 ------------------
        if (abmin.login("admin", "admin123")) {
            System.out.println("管理员登录成功");
            abmin.addParent(new Parent("staff001", "张三", "男寝宿管"));
            abmin.viewParentList();
            abmin.deleteParent(null);
            abmin.logout();
        }
        // ------------------ 宿管操作 ------------------
        /*
         * if (parent.login("staff01", "staff123")) { 
                 * System.out.println("宿管登录成功");
                 * Student newStudent = new Student();
                 * newStudent.registerInfo(Map.of("name", "李四", "gender", "男", "tel", "138xxxx1234" )); 
                 * parent.addStudent(newStudent);
                 * parent.logout();
              }
         */
          System.out.println("宿管登录成功");
          Map<String, String> mutableMap = new HashMap<>();
          System.out.println("新增学生信息：");
          mutableMap.put("name", "李四");
          mutableMap.put("gender", "男");
          mutableMap.put("tel", "138xxxx1234");
                
          Map<String, String> immutableMap = Collections.unmodifiableMap(mutableMap);
          System.out.println(immutableMap);
          
        // ------------------ 学生操作 ------------------
        if (student.login("2025001", "student123")) {
            System.out.println("学生登录成功");
            student.queryDorm("D305");
            
         // 学生提交维修申请
            student.applyRepair("房间门锁损坏", parent);
            // 宿管查看维修申请
            if (parent.login("staff01", "staff123")) {
                parent.viewRepairRequests();
                parent.logout();
            }
            student.logout();
        }
    }
}